namespace NICWebApi.Extensions.Caching.Interfaces;

/// <summary>
/// 缓存键生成器接口
/// </summary>
public interface ISimpleCacheKeyGenerator
{
    /// <summary>
    /// 生成缓存键
    /// </summary>
    /// <param name="args">缓存键参数</param>
    /// <returns>生成的缓存键</returns>
    string Generate(params object[] args);

    /// <summary>
    /// 生成缓存键
    /// </summary>
    /// <param name="baseKey">基础键</param>
    /// <param name="parameters">缓存键参数</param>
    /// <returns>生成的缓存键</returns>
    string Generate(string baseKey, params object[] parameters);

    /// <summary>
    /// 生成带前缀的缓存键
    /// </summary>
    /// <param name="prefix"></param>
    /// <param name="keyParts"></param>
    /// <returns></returns>
    string GenerateWithPrefix(string prefix, params object[] keyParts);

    /// <summary>
    /// 生成模式匹配键（用于模式删除）
    /// </summary>
    /// <param name="pattern">模式</param>
    /// <returns>生成的模式匹配键</returns>
    string GeneratePatternKey(string pattern);

    /// <summary>
    /// 根据类型生成缓存键
    /// </summary>
    /// <typeparam name="T">类型</typeparam>
    /// <param name="args">附加参数</param>
    /// <returns>生成的缓存键</returns>
    string GenerateForType<T>(params object[] args);

    /// <summary>
    /// 规范化缓存键
    /// </summary>
    /// <param name="key">原始键</param>
    /// <returns>规范化后的键</returns>
    string NormalizeKey(string key);
}